package cz.cvut.fit.web.nakupniSeznam.data;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

@Entity (name = "category")
@NamedQueries({
	@NamedQuery(name="category.getAll", query="SELECT c FROM category c"),
	@NamedQuery(name="category.getByOwner", query="SELECT c FROM category c WHERE WHERE :owner = c.owner"),
	@NamedQuery(name="category.getByOwnerAndName", query="SELECT c FROM category c WHERE c.owner = :owner AND c.name= :name")
})
public class Category implements IEntity {
	
	public static final String QUERY_CATEGORY_ALL = "category.getAll";
	public static final String QUERY_CATEGORY_BY_OWNER_AND_NAME = "category.getByOwnerAndName";
	public static final String QUERY_CATEGORY_BY_OWNER = "category.getByOwnerAndName";
	
	public static final String QUERY_PARAM_NAME = "name";
	public static final String QUERY_PARAM_OWNER = "owner";
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	private String name;
	
	private String owner;
	
	private Long lastChanged;
	

	@Override
	public Long getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getOwner() {
		return owner;
	}

	public void setOwner(String owner) {
		this.owner = owner;
	}

	public Long getLastChanged() {
		return lastChanged;
	}

	public void setLastChanged(Long lastChanged) {
		this.lastChanged = lastChanged;
	}
}
